package logger2;

import javax.swing.JFrame;

import gui.MultiTabWindow;
import logger2.colorer.Colorer;
import logger2.colorer.gui.ColorerManager;
import logger2.environment.Environment;
import logger2.filter.ConfigurableFilter;
import logger2.filter.gui.ConfigurableFilterPanel;
import logger2.filter.gui.FilterManagerPanel;
import logger2.formatter.ConfigurableLogFormatter;
import logger2.printer.ConsolePrinter;

public class Test {

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
		Environment env = new Environment();
		
		test_logger();
		
		ConfigurableFilter filter1 = new ConfigurableFilter(env);
		ConfigurableFilter filter2 = new ConfigurableFilter(env);
		ConfigurableFilter filter3 = new ConfigurableFilter(env);
		
		MultiTabWindow window = new MultiTabWindow();
		window.addTab(new FilterManagerPanel(env), "Filtre");
		
		ColorerManager colorerManager = new ColorerManager(env);
		Colorer colorer = new Colorer(env, "Coucou");
		window.addTab(colorerManager, "Colorers");
		
		window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		window.setVisible(true);
		
		
		
	}
	
	public static void test_logger() {
		Logger.addPrinter(new ConsolePrinter(new ConfigurableLogFormatter("%d - %l - %L : \n\t%m\n\t%t => %T", "HH:mm:ss.SSS")));	
		
		Logger.getLogger("test").fine("coucou 1");
		Logger.getLogger("test.tata").warning("coucou 2");
		Logger.getLogger("test").config("coucou 3");
		Logger.getLogger("test.tutu").severe("coucou 4");
		
		Logger logger = Logger.getLogger("router");
		
		logger.info("coucou");
	}

}
